/***
This do-file processes information about the landarea of each ZCTA. 
***/

*-------------------------------------------------------------------------------
* Set up
*-------------------------------------------------------------------------------

* Set $root
project figstabs, root
if (r(buildrunning)==0) include "${root}/code/config_interactive.do"

* Create required folders
cap mkdir "${root}/data/derived/ACS 2014-2018 5-Year ZCTA"
cap mkdir "${root}/data/derived/ACS 2014-2018 5-Year ZCTA/Individual Variables"

*-------------------------------------------------------------------------------
* Load raw and clean data
*-------------------------------------------------------------------------------

project, uses("${root}/data/dvc/ACS 2014-2018 5-Year ZCTA/Area/zcta_county_rel_10.txt")
import delimited "${root}/data/dvc/ACS 2014-2018 5-Year ZCTA/Area/zcta_county_rel_10.txt", encoding(ISO-8859-2) clear

* Keep the variables of interest, including ZCTA land area rather than total area
keep zcta5 zarealand

* Data contains duplicate observations and these are dropped
duplicates drop

*-------------------------------------------------------------------------------
* Save file
*-------------------------------------------------------------------------------

save "${root}/data/derived/ACS 2014-2018 5-Year ZCTA/Individual Variables/2010 Census ZCTA Area.dta", replace
project, creates("${root}/data/derived/ACS 2014-2018 5-Year ZCTA/Individual Variables/2010 Census ZCTA Area.dta")
